print("Giai Phuong trinh bac 2\n")
print('a = ')
a = gets.to_i
print('b = ')
b = gets.to_i
print('c = ')
c = gets.to_i

d = b*b - 4*a*c

if d>0
  x1 = (-b-Math.sqrt(d))/(2*a)

  x2 = (-b+Math.sqrt(d))/(2*a)
  print("Phuong trinh co 2 nghiem phan biet\n")
  puts "%.4f"%x1
  puts "%.4f"%x2
elsif d==0
  printf("Phuong trinh co nghiem kep\n")
  x1 = -b/(2*a)
  puts "%.4f"%x1
else
  printf("Phuong trinh co nghiem phuc\n")
  d = d.abs
  _sophuc = Math.sqrt(d)/(2*a)
  _sophuc = _sophuc .abs
  _pre = -b/(2*a)
  puts "#{"%.4f"%_pre}+#{"%.4f"%_sophuc}i"
  puts "#{"%.4f"%_pre}-#{"%.4f"%_sophuc}i"
end
